package com.avic.rong.goodsSort.api;

import com.avic.rong.api.HttpPostService;
import com.avic.rong.utils.ConstantsUtils;
import com.example.minato.minastore.BaseApi;
import com.example.minato.minastore.listener.HttpOnNextListener;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import io.reactivex.Observable;
import retrofit2.Retrofit;

/**
 * Created by Chenjiaxin on 2019/7/24 14:10
 * E-Mail Address：16601203965@163.com
 */
public class MuluSearchApi extends BaseApi {

    private int mulu;
    private String keyword = ConstantsUtils.EMPTY_STR;
    private int sort = 0;
    private String attrPro = ConstantsUtils.EMPTY_STR;
    private int pageNo = 1;


    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public void setAttrPro(String attrPro) {
        this.attrPro = attrPro;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public MuluSearchApi(RxAppCompatActivity rxAppCompatActivity, HttpOnNextListener listener) {
        super(rxAppCompatActivity, listener);
        setCache(false);
    }


    public void setArgument(int mulu, int sort, String keyword,String attrPro) {
        this.mulu = mulu;
        this.sort = sort;
        this.keyword = keyword;
        this.attrPro = attrPro;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.searchAllForCat(mulu,sort, keyword, attrPro, pageNo);
    }


}
